﻿namespace WMS6.Services
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.ServiceModel.Activation;
    using WMS6.BLL;
    using WMS6.Common;
    using WMS6.DataEntity;

    [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
    public class RFOutboundService : IRFOutboundService
    {
        public string BatchPickingByWave(string waveID, string lpnID, PubParasInfo pubParasInfo)
        {
            string result = string.Empty;
            try
            {
                result = new RFOutboundBLL(pubParasInfo).BatchPickingByWave(waveID, lpnID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "RFOutboundService异常");
            }
            return result;
        }

        public void BatchShippingByWave(string waveID, PubParasInfo pubParasInfo)
        {
            try
            {
                new RFOutboundBLL(pubParasInfo).BatchShippingByWave(waveID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
        }

        public string GeneratePickingByLpn(string orderID, string lpnID, PubParasInfo pubParasInfo)
        {
            string result = string.Empty;
            try
            {
                result = new RFOutboundBLL(pubParasInfo).GeneratePickingByLpn(orderID, lpnID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "RFOutboundService异常");
            }
            return result;
        }

        public DataSet GetAllAvailableSalesOrderPickInfo(string orderID, PubParasInfo pubParasInfo)
        {
            DataSet ds = null;
            try
            {
                ds = new RFOutboundBLL(pubParasInfo).GetAllAvailableSalesOrderPickInfo(orderID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "RFOutboundService异常");
            }
            return ds;
        }

        public DataSet GetAllAvailableSalesOrderShipInfo(string orderID, PubParasInfo pubParasInfo)
        {
            DataSet ds = null;
            try
            {
                ds = new RFOutboundBLL(pubParasInfo).GetAllAvailableSalesOrderShipInfo(orderID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "RFOutboundService异常");
            }
            return ds;
        }

        public List<PickDetailInfo> GetPickDetailListInfoByLpn(string lpnID, PubParasInfo pubParasInfo)
        {
            List<PickDetailInfo> pickDetailInfoList = null;
            try
            {
                pickDetailInfoList = new RFOutboundBLL(pubParasInfo).GetPickDetailListInfoByLpn(lpnID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "RFOutboundService异常");
            }
            return pickDetailInfoList;
        }

        public string GetRotationRuleByPickInfo(string lpnID, string waveID, string orderID, PubParasInfo pubParasInfo)
        {
            string result = string.Empty;
            try
            {
                result = new RFOutboundBLL(pubParasInfo).GetRotationRuleByPickInfo(lpnID, waveID, orderID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return result;
        }

        public DataSet GetWaveByQueryListPickInfo(string waveID, PubParasInfo pubParasInfo)
        {
            DataSet ds = null;
            try
            {
                ds = new RFOutboundBLL(pubParasInfo).GetWaveByQueryListPickInfo(waveID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "RFOutboundService异常");
            }
            return ds;
        }

        public DataSet GetWaveByQueryListShippingInfo(string waveID, PubParasInfo pubParasInfo)
        {
            DataSet ds = null;
            try
            {
                ds = new RFOutboundBLL(pubParasInfo).GetWaveByQueryListShippingInfo(waveID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "RFOutboundService异常");
            }
            return ds;
        }

        public string ShippedByLpnID(string lpnID, PubParasInfo pubParasInfo)
        {
            string result = string.Empty;
            try
            {
                result = new RFOutboundBLL(pubParasInfo).ShippedByLpnID(lpnID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "RFOutboundService异常");
            }
            return result;
        }

        public string ShippedByOrderID(List<string> orderID, PubParasInfo pubParasInfo)
        {
            string result = string.Empty;
            try
            {
                result = new RFOutboundBLL(pubParasInfo).ShippedByOrderID(orderID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "RFOutboundService异常");
            }
            return result;
        }
    }
}

